import axios from '@/utils/request'
// import store from '@/store'

/**
 * 获取用户登陆信息
 * @param {*} mobile
 * @param {*} code
 * @returns
 */
export const userLogin = (mobile, code) => {
  return axios({
    method: 'POST',
    url: '/v1_0/authorizations',
    data: {
      mobile,
      code
    }
  })
}

/**
 *用户个人信息
 * @returns
 */
export const userInfo = () => {
  // const token = store.state.user.token.token
  return axios({
    url: '/v1_0/user/profile'
    // headers: {
    //   Authorization: `Bearer ${token}`
    // }
  })
}

/**
 * 修改个人资料
 * @param {*} data 需要修改的信息
 * @returns
 */
export const editUser = data => {
  return axios({
    url: '/v1_0/user/profile',
    method: 'patch',
    data
  })
}

/**
 * 修改用户头像
 * @param {*} data FromData对象
 * @returns
 */
export const editUserPhoto = data => {
  return axios({
    url: '/v1_0/user/photo',
    method: 'PATCH',
    data
  })
}
